<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
    <HEAD>
        <TITLE>用户登录</TITLE>
        <LINK href="images/User_Login.css" type=text/css rel=stylesheet>
        <META http-equiv=Content-Type content="text/html; charset=UTF-8">
<script type='text/javascript' src='dwr/interface/loginDispose.js'></script>
  <script type='text/javascript' src='dwr/engine.js'></script>
   <script type='text/javascript' src='dwr/util.js'></script>
		<script type="text/javascript">
			/**载入loading动画,imageSrc:动画图片地址*/
function useLoadingImage(imageSrc) {
  var loadingImage;
  if (imageSrc) loadingImage = imageSrc;
  else loadingImage = "ajax-loader.gif";
  dwr.engine.setPreHook(function() {
    var disabledImageZone = $('disabledImageZone');
    if (!disabledImageZone) {
      disabledImageZone = document.createElement('div');
      disabledImageZone.setAttribute('id', 'disabledImageZone');
      disabledImageZone.style.position = "absolute";
      disabledImageZone.style.zIndex = "1000";
      disabledImageZone.style.right = "600px";
      disabledImageZone.style.top = "400px";
      disabledImageZone.style.width = "100%";
      disabledImageZone.style.height = "100%";
      var imageZone = document.createElement('img');
      imageZone.setAttribute('id','imageZone');
      imageZone.setAttribute('src',imageSrc);
      imageZone.style.position = "absolute";
      imageZone.style.top = "0px";
      imageZone.style.right = "0px";
      disabledImageZone.appendChild(imageZone);
      document.body.appendChild(disabledImageZone);

    }
    else {
      $('imageZone').src = imageSrc;
      disabledImageZone.style.visibility = 'visible';
    }
  });
  dwr.engine.setPostHook(function() {
    $('disabledImageZone').style.visibility = 'hidden';
  });
}

			//发送用户登陆请求
		function loginRequest(){
			useLoadingImage("images/progress_bar.jpg");
			//dwr.util.useLoadingMessage("正在处理，请稍后......");
		var userName=dwr.util.getValue("TxtUserName");
		var userPwd=dwr.util.getValue("TxtPassword");
		var role=dwr.util.getValue("role");
		//调用服务器上用户登陆验证的方法
		loginDispose.loginValidate(userName,userPwd,role,callBack)
		}

		//回调函数
		function callBack(data){
			var d=jstrim(data);
			if (d == "error") {
				alert("用户不存在");
			}
			else {
				if (d == "serror") {
					alert("系统出现故障");
				}
				else {
					window.location.href="index.jsp";
				}
			}
		}

		 //去掉字符串的首尾空格
 			function   jstrim(s)
 			 {
 				 return   s.replace(/(^\s*)|(\s*$)/g,"");
 			 }
		</script>
    </HEAD>
    <BODY id=userlogin_body>
        <DIV id=user_login>
            <DL>
                <DD id=user_top>
                    <UL>
                        <LI class=user_top_l>
                        </LI>
                        <LI class=user_top_c>
                        </LI>
                        <LI class=user_top_r>
                        </LI>
                    </UL>
                    <DD id=user_main>
                        <UL>
                            <LI class=user_main_l>
                            </LI>
                            <LI class=user_main_c>
                                <DIV class=user_main_box>
                                    <UL>
                                        <LI class=user_main_text>
                                            用户名：
                                        </LI>
                                        <LI class=user_main_input>
                                            <INPUT class=TxtUserNameCssClass id=TxtUserName maxLength=20 name=TxtUserName type="text">
                                        </LI>
                                    </UL>
                                    <UL>
                                        <LI class=user_main_text>
                                            密 码：
                                        </LI>
                                        <LI class=user_main_input>
                                            <INPUT class=TxtPasswordCssClass id=TxtPassword type=password name=TxtPassword>
                                        </LI>
                                    </UL>
                                    <UL>
                                        <LI class=user_main_text>
                                            用户：
                                        </LI>
                                        <LI class=user_main_input>
                                            <SELECT id=role name=role>
                                                <OPTION value="员工" selected>员工</OPTION>
                                                <OPTION value="主管">主管</OPTION>
                                                <OPTION value="系统管理员">系统管理员</OPTION>
                                            </SELECT>
                                        </LI>
                                    </UL>
                                </DIV>
                            </LI>
                            <LI class=user_main_r>
                                <INPUT class=IbtnEnterCssClass id=IbtnEnter style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" onclick='loginRequest();' type=image src="images/user_botton.gif" name=IbtnEnter>
                            </LI>
                        </UL>
                        <DD id=user_bottom>
                            <UL>
                                <LI class=user_bottom_l>
                                </LI>
                                <LI class=user_bottom_c>
                                </LI>
                                <LI class=user_bottom_r>
                                </LI>
                            </UL>
                        </DD>
                        </DL>
                    </DIV>
                    </BODY>
                </HTML>
